Add documentation for test artifacts/attachments#4074
Merged
Conversation
Co-authored-by: thomhurst <30480171+thomhurst@users.noreply.github.com>
Co-authored-by: thomhurst <30480171+thomhurst@users.noreply.github.com>
Co-authored-by: thomhurst <30480171+thomhurst@users.noreply.github.com>
Co-authored-by: thomhurst <30480171+thomhurst@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for test attachments in TUnit
Add documentation for test artifacts/attachments
Dec 14, 2025
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive documentation for TUnit's existing test artifact/attachment functionality, addressing user confusion about how to migrate from NUnit's TestContext.AddTestAttachment() API.
Key changes:
- New comprehensive artifacts guide covering test-level and session-level artifacts with real-world examples
- Updated test-context.md to document the
Output.AttachArtifact()API - Migration guide updates for NUnit, MSTest, and xUnit showing equivalent artifact attachment patterns
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
docs/docs/test-lifecycle/artifacts.md |
New comprehensive guide documenting artifact attachment at test and session levels, with best practices and common use cases (Playwright, API testing, database testing) |
docs/docs/test-lifecycle/test-context.md |
Added "Test Output and Artifacts" section explaining both Output.WriteLine() and OutputWriter.WriteLine() patterns, plus artifact attachment |
docs/sidebars.ts |
Added artifacts.md to the test-lifecycle section navigation |
docs/docs/migration/nunit.md |
Added test attachment migration example showing NUnit's TestContext.AddTestAttachment() mapped to TUnit's Artifact class |
docs/docs/migration/mstest.md |
Added test attachment migration example showing MSTest's TestContext.AddResultFile() mapped to TUnit's Artifact class |
docs/docs/migration/xunit.md |
Added test attachment migration example showing xUnit v3's FileAttachment mapped to TUnit's Artifact class |
docs/yarn.lock |
Dependency version updates (unrelated to the documentation feature) |
This was referenced Dec 15, 2025
This was referenced Jan 26, 2026
This was referenced Feb 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
TUnit already supports test artifacts via
TestContext.Output.AttachArtifact()andTestSessionContext.AddArtifact(), but lacked documentation. Users migrating from NUnit were confused by the missing equivalent toTestContext.AddTestAttachment().Added:
Comprehensive artifacts guide (
docs/docs/test-lifecycle/artifacts.md)Updated test-context.md
Output.WriteLine()(interface-based) andOutputWriter.WriteLine()(direct TextWriter) patternsUpdated migration guides (NUnit, MSTest, xUnit)
ArtifactclassExample usage:
Related Issue
Fixes #4612
Type of Change
Checklist
Required
TUnit-Specific Requirements
Testing
dotnet test)TestArtifactTests.csvalidates documented API)Additional Notes
Documentation builds successfully with Docusaurus. All internal links resolve correctly. Existing artifact test validates the documented API works as specified.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.